<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>登录</title>
		<link href="../css/css.css" rel="stylesheet" />
		<script src="../js/vue.js"></script>
		<script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>

	</head>
	<body>
		<table id="out">
			<tr>
				<td id="title">登录</td>
			</tr>
			<tr>
				<input type="text" name="phone" placeholder="请输入手机号码" id="phone" v-model="userPhone" />
				</br>
				<input type="password" name="password" placeholder="请输入密码" id="password" v-model="userPassword" />
			</tr>
			<tr>
				<input type="button" value="登录" id="button" v-on:click="login" />
			</tr>
		</table>
	</body>
	<script>
		window.onload = function() {
			var vue = new Vue({
				el: '#out',
				data: {
					userPhone: '',
					userPassword: ''
				},
				methods: {
					login: function() {

						var url = 'http://localhost:8080/attendance-service/zhyUser/post.do';
						// url=发送请求的链接，和后端匹配
						// 第二个参数规定是对象：{元素名:元素}    要传给后台的数据
						// emulateJSON:false固定     是false还是true视实际情况更改
						this.$http.post(url, {
							method: 'findId',
							userPhone: this.userPhone,
							userPassword: this.userPassword
						}, {
							emulateJSON: false
						}).then(function(backdatas) {
							console.log(backdatas);
						});
						
						window.location.href="http://localhost:8080/attendance-service/zhouhaiyan-public/html/role-list.html"

					}
				}
			});
		};
	</script>
</html>
